<%--
  Created by IntelliJ IDEA.
  User: ChadZhao
  Date: 12-5-14
  Time: 下午1:20
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>自动上传</title>

    <style type="text/css">
        <!--
        body,td,th {
            font-size: 14px;
            color: #666666;
        }
        .form { width:99%; padding:5px;}
        .form th { text-align:right; font-weight:bold; padding:5px;}
        .form td { text-align:left; padding:5px;}
        .listinput { border:1px solid #ccc; padding:3px; background-image:url(<c:url value='/images/listinputbg.gif'/>); width:200px;height:24px;}
        .select1  { border:1px solid #ccc; padding:3px;}
        .button { background-image:url(<c:url value='/images/butbg.gif'/>); height:30px; line-height:30px; color:#FFFFFF; font-weight:bold; border:0px; cursor:hand;}
        .form_processbar{vertical-align:middle;position:relative;display:inline-block;*display:inline;*zoom:1;overflow:hidden;-moz-user-select:none;-webkit-user-select:none;}
        .form_processbar .process{position:relative;z-index:1;overflow:hidden;background:url(<c:url value='/images/yesin.jpg'/>);height:23px;overflow:hidden;}
        .form_processbar .percent{position:relative;top:-18px;z-index:2;width:100%;height:16px;overflow:hidden;line-height:16px;text-align:center;color:#555;font-size:14px;}
        .line { position:relative;padding:8px 0}
        .line span { float:left}
        .file { position:absolute; left:90px; top:8px; display:none;filter:alpha(opacity=0);opacity:0}
        .file1 { height:25px;width:35px; display:block; float:left;background-image:url(<c:url value='/images/index_14.jpg'/>); z-index:1; margin-left:5px; vertical-align:middle; cursor: pointer}
        .inputstyle { width:180px;height:25px; border:1px solid #888; z-index:99;background-image:url(<c:url value='/images/listinputbg.gif'/>);}
        -->
    </style>
</head>
<body>
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div style='float:left'> <img height="14" src="<c:url value='/frame/book1.gif'/>" width="20" />&nbsp;编辑音视频信息 </div>
      <div style='float:right;padding-right:8px;'>
        <!--  //保留接口  -->
      </div></td>
  </tr>
  <tr>
    <td height="1" background="<c:url value='/frame/sp_bg.gif'/>" style='padding:0px'></td>
  </tr>
</table>
    <form method="post" enctype="multipart/form-data">

    <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top: 15px;">
  <tr>
    <td align="center" id="fileinfotd">
    <table border="0" cellpadding="0" cellspacing="0" class="form" style="margin-left: auto;margin-right: auto;width:65%;border:1px solid #CACACA;">
        <tr style="height:36px;">
            <td style="text-align: right;">
                <span style="color:#FF0000;">*</span>&nbsp;<span style="font-size: 14px;font-weight: bold;">标题：</span>
            </td>
            <td align="left">
                <s:textfield theme="simple" name="articleTitle" id="articleTitle" cssClass="listinput" cssStyle="width:350px;"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                <div id='mediaplayer' style="width:360px;height:270px;"></div>
            </td>
        </tr>
        <tr style="height:110px;">
            <td style="text-align: right;"><input type="file" name="uploads" onchange="document.getElementById('viewfile').value=this.value;this.style.display='none';" class="file" id="uploadfile"/>
                <span style="font-size: 14px;font-weight: bold;">简介：</span>
            </td>
            <td align="left">
                <s:textarea theme="simple" rows="8" cols="40" name="contextArea" id="contextArea" onblur="cutword(this,500)"/>
            </td>
        </tr>
        <s:if test="videoAudioFlag==\"1\"">
        <tr style="height:36px;">
            <td style="text-align: right;">
                <span style="font-size: 14px;font-weight: bold;">封面图：</span>
            </td>
            <td align="left">
                <input type="file" name="uploads" class="listinput" style="width:300px;" id="imgFile"/>
                <%--<div class="line">--%>
                    <%--<span><label></label>--%>
                        <%--<input name="tempin2" type="text" id="viewfile2" onmouseout="document.getElementById('imgFile').style.display='none';" class="listinput"/>--%>
                    <%--</span>--%>
                    <%--<label for="imgFile" onmouseover="document.getElementById('imgFile').style.display='block';" class="file1"></label>--%>
                    <%--<input type="file" name="uploads" onchange="document.getElementById('viewfile2').value=this.value;this.style.display='none';" class="file" id="imgFile"/>--%>
                <%--</div>--%>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align:center;">
                <img width="320" height="240" src="<s:property value='imgPath'/>"/>
            </td>
        </tr>
        </s:if>
            <s:if test="checkComment!=null || dataType==\"2\"">
            <tr>
                <th>审核意见</th>
                <td style="padding:6px 0px 6px 10px;">
                    <s:if test="dataType==\"2\"">
                    <s:textarea cols="50" id="checkCommentArea" name="checkComment" rows="6" theme="simple" onblur="cutword(this,500)"></s:textarea>
                    </s:if>
                    <s:else>
                        <s:property value="checkComment" escape="false"/>
                    </s:else>
                </td>
            </tr>
            </s:if>
        <tr style="height:40px;">
            <td colspan="2" style="text-align: center;">
                <s:if test="dataType==\"2\"">
                    &nbsp;
                    <button type="button" class="button" onClick="passCheck('1')">审核通过</button>
                    &nbsp;
                    <button type="button" class="button" onClick="passCheck('2')">审核不通过</button>
                    &nbsp;
                    <button type="button" class="button" style="width:50px;" onclick="location.href='<c:url value='/system/toCheckVideoList.do?targerPageNum=1'/>'">返回</button>
                </s:if>
                <s:else>
                    <button type="button" class="button" id="savebt" style="width:50px;" onclick="dosave()">保存</button>&nbsp;
                    <button type="button" class="button" style="width:50px;" onclick="location.href='<c:url value='/system/editVideoDetailList.do?articleId='/><s:property value="articleId"/>&partType=<s:property value="partType"/>'">返回</button>
                </s:else>
            </td>
        </tr>
    </table>
        <s:hidden name="articleId"/>
        <s:hidden name="detailId"/>
        <s:hidden name="partType"/>
        <s:hidden name="dataType"/>
        <s:hidden name="videoAudioFlag"/>
        <input type="hidden" name="filedeType" id="filedeType"/>
        <input type="hidden" name="imgFlag" id="imgFlag"/>
    </td>
  </tr>
</table>
      <div id="upfilediv" style="position:absolute;top:0px;left:0px;text-align:center;filter:alpha(opacity=60);opacity:0.6;background-color:#000000;z-index:2;display:none;">
          <img src="<c:url value='/images/waiting.gif'/>"/> <p style="color:#FFFFFF;">上传中请稍候……</p>
      </div>
    </form>
<iframe name="hidframe1" id="hidframe1" frameborder="0" style="display: none;" src="javascript:void(0);"></iframe>
</body>
<script>

    var types = document.getElementById("partType").value;
    if(types != "" && types != "0") {
        var tss = types.split(",");
        for (var a = 0; a < tss.length; a ++) {
            document.getElementById("articleType"+tss[a]).checked = true;
        }
    }

    function cutword(obj,leng) {
        var summ = obj.value;
        if(summ.length > leng) {
            obj.value = summ.substring(0,leng);
        }
    }

    function passCheck(rr) {
        if(rr=='2' && document.getElementById("checkCommentArea").value=="") {
            alert("请输入审核意见以便录入人员修改！");
            return;
        }
        if (document.getElementById("articleTitle").value == "") {
            alert("请输入标题！");
            return;
        }
        var thetypename = "音频";
        if (document.getElementById("videoAudioFlag").value=="1") {
            if (document.getElementById("imgFile").value=="") {
                document.getElementById("imgFlag").value = "0";
            }
            thetypename = "视频";
        }
        if(rr=='2') {
            if(!confirm("您确定不通过本"+thetypename+"的审核并退回录入人员吗？")) {
                return;
            }
        } else {
            if(!confirm("您确定通过本"+thetypename+"的审核吗？")) {
                return;
            }
        }
        document.forms[0].action="<c:url value='/system/doVideoCheck.do?checkFlag='/>"+rr;
        document.forms[0].submit();
    }

    function dosave(){
        if (document.getElementById("articleTitle").value == "") {
            alert("请输入标题！");
            return;
        }
        var thetypename = "音频";
        if (document.getElementById("videoAudioFlag").value=="1") {
            if (document.getElementById("imgFile").value=="") {
                document.getElementById("imgFlag").value = "0";
            }
            thetypename = "视频";
        }
        var mess = "您确定保存该"+thetypename+"吗？";
        if(document.getElementById("contextArea").value == "") mess = "您没有录入简介，确定保存吗？";
        if(!confirm(mess)) {
            return;
        }
        document.getElementById("savebt").disabled = true;
        document.forms[0].target = "hidframe1";
        document.forms[0].action="<c:url value='/system/saveVideoInfo.do'/>";
        document.forms[0].submit();
    }

    function hidDiv() {
        document.getElementById("upfilediv").style.height = 0;
        document.getElementById("upfilediv").style.width = 0;
        document.getElementById("upfilediv").style.display = "none";
    }
</script>
<script type="text/javascript" src="<c:url value='/script/swfobject.js'/>"></script>

<script type="text/javascript">

    var flashvars = {
        'file':   '<s:property value="filePath"/>',
        'image': '<s:property value="imgPath"/>',
        'skin': '<c:url value='/script/skins/whotube.zip'/>',
        'autostart': 'true',
        'controlbar':     'bottom'
    };

    var params = {
        'allowfullscreen':        'true',
        'allowscriptaccess':      'always'
    };

    var attributes = {
        'id':                     'playerID',
        'name':                   'playerID'
    };
    var theHeight = '270';
    <s:if test="videoAudioFlag==\"2\"">theHeight = '24';</s:if>

    swfobject.embedSWF('<c:url value='/script/player.swf'/>', 'mediaplayer', '360', theHeight, '9', 'true',
            flashvars, params, attributes);
    parent._setHeight();
</script>
</html>